<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<input id="num1"/> 
		<select id="fuhao">
			<option value="+">加</option>
			<option value="-">减</option>
			<option value="*">乘</option>
			<option value="/">除</option>
		</select>
		<input id="num2"/>
		<input id="jisuanBtn" type="button" value="计算"/>
		<br /><br />
		结果：<textarea id="result" rows="7" style="width: 500px;"></textarea>
	</body>
	<script>
		
		document.getElementById("jisuanBtn").onclick = function(){
			var fuhao = document.getElementById("fuhao").value;
			var res = '';
			var num1 = parseInt(document.getElementById("num1").value);
			var num2 = parseInt(document.getElementById("num2").value);
			switch(fuhao){
				case '+':
					res = num1 + num2;
					res = num1 + "+" + num2 + "=" + res;
				break;
				case '-':
					res = num1 - num2;
					res = num1 + "-" + num2 + "=" + res;
				break;
				case '*':
					res = num1 * num2;
					res = num1 + "*" + num2 + "=" + res;
				break;
				case '/':
					res = num1 / num2;
					res = num1 + "/" + num2 + "=" + res;
				break;
			}
			var result = document.getElementById("result");
			result.value = result.value + res+"\r\n";
		};
		
	</script>
</html>
